﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Net5ApiAndEfMySql.DtoModel
{
    public class SearchModel
    {
        public SearchModel()
        {
            SearchItem = new Dictionary<string, string>();
            page = 1;
            limit = 3;
            start = 0;
        }
        public int draw { get; set; }
        public int page { get; set; }
        public int limit { get; set; }


        private int _start = -1;
        /// <summary>
        /// 起始记录
        /// </summary>
        public int start
        {
            get
            {

                if (page > 0)
                {
                    return (page - 1) * limit;
                }
                return 0;


            }
            set
            {
                _start = value;
            }
        }
        /// <summary>
        /// 结束记录
        /// </summary>
        public int end
        {
            get
            {
                return limit + start;
            }
        }
        public string OrderBy { get; set; }
        public OrderByType OrderByType { get; set; }
        public Dictionary<string, string> SearchItem { get; set; }
    }
    public enum OrderByType
    {
        ASC,
        DESC
    }
}
